#include "Nod.h"
#include <iostream>
#include "Nod.h"


Nod::Nod(int val):value(val)
{
}


Nod::~Nod(void)
{
}

void Nod::addParent(Nod* const ancestor)
{
	Parents.push_back(ancestor);
}

void Nod::addChild(Nod* const baby)
{
	Children.push_back(baby);
}

void Nod::showFamily() const
{
	if(!Parents.empty())
	{
		std::cout<<"Parent: "<<std::endl;
		for(std::vector<Nod* const>::const_iterator iter= Parents.begin(); iter!=Parents.end(); iter++)
			(*iter)->showValue();
	}
	if(!Children.empty())
	{
		std::cout<<"Children: "<<std::endl;
		for(std::vector<Nod* const>::const_iterator iter= Children.begin(); iter!=Children.end(); iter++)
			(*iter)->showValue();
	}
}

void Nod::showValue() const
{
	std::cout<<value;
}

bool Nod::hasChild() const
{
	return (Children.empty()?0:1);
}

bool Nod::hasParent() const
{
	return (Parents.empty()?0:1);
}

std::vector<Nod* const> & Nod::getParents()
{
	return Parents;
}

std::vector<Nod* const> & Nod::getChildren()
{
	return Children;
}

